package com.qolome.metadata;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;

/**
 * @author Qolome
 * @version V1.0
 * @Description 清表
 * @date 2020年 01月12日 20:13:24
 */
public class DeleteAllMethod extends AbstractMethod {


    @Override
    public MappedStatement injectMappedStatement (Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {

        // 执行  SQL
        String sql =  String.format ("delete from %s",tableInfo.getTableName ());
        // Mapper接口方法
        String method = "deleteAll";
        SqlSource sqlSource = languageDriver.createSqlSource (configuration, sql, modelClass);
        return addDeleteMappedStatement (mapperClass,method,sqlSource);
    }
}
